/*
 * @Author: 别拿暗恋当饭吃. 13466071+lililkli@user.noreply.gitee.com
 * @Date: 2024-07-08 08:44:12
 * @LastEditors: 别拿暗恋当饭吃. 13466071+lililkli@user.noreply.gitee.com
 * @LastEditTime: 2024-07-11 16:27:04
 * @FilePath: \doctor\src\pages\Consultationinformation\Listofinformation\index.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import React, { useEffect } from "react";
import { NavBar, Space, Toast } from 'antd-mobile'
import { useDispatch, useSelector } from 'react-redux'
import { useNavigate } from "react-router-dom";
import { dohistoricalconsultation, HistoricalconsultationSelecer } from 'store/Consultationinformation/Historicalconsultation'
import "./style.scss"
const Index = () => {
    const dispatch = useDispatch<any>()
    const navigate = useNavigate()
    const right = (
        <div style={{ fontSize: 13 }}>
            <Space style={{ '--gap': '12px' }}>
                <div onClick={() => navigate('/GiftList')}>
                    收到的礼物
                </div>
            </Space>
        </div>
    )
    const back = () =>
        Toast.show({
            content: '点击了返回区域',
            duration: 1000,
        })
    //查看历史记录
    const interviewchathistory = () => {
        navigate('/interviewchathistory')
    }
    //查看评价
    const checkoutthereviews = () => {
        navigate('/checkoutthereviews')
    }
    const Historicalconsultationlist = useSelector(HistoricalconsultationSelecer)

    useEffect(() => {
        const data = {
            page: 1,
            count: 5
        }
        dispatch(dohistoricalconsultation(data))
    }, [])
    return (
        <div className="historicalconsultation">
            <NavBar onBack={back} right={right} style={{ borderBottom: '0.05rem solid #999' }}>历史问诊</NavBar>
            {
                Historicalconsultationlist && Historicalconsultationlist.length > 0 ? Historicalconsultationlist.map((v: any, i: any) =>

                    <div className="historicalconsultation-con" key='i'>
                        <div className="historicalconsultation-con-left">
                            <img src={Historicalconsultationlist.userHeadPic} alt="" />
                        </div>
                        {/* 右盒子 */}
                        <div className="historicalconsultation-con-right">
                            <p>问诊人<span>{Historicalconsultationlist.nickName}</span></p>
                            <p>问诊时间<span>{Historicalconsultationlist.inquiryTime}</span></p>
                            <p className="chkan"><span onClick={interviewchathistory}>查看问诊记录</span><span onClick={checkoutthereviews}>查看评价</span></p>
                        </div>
                    </div>
                ) : <div>暂无历史问诊记录!</div>
            }
            <div className="historicalconsultation-con" key='i'>
                <div className="historicalconsultation-con-left">
                    <img src={Historicalconsultationlist.userHeadPic} alt="" />
                </div>
                {/* 右盒子 */}
                <div className="historicalconsultation-con-right">
                    <p>问诊人<span>{Historicalconsultationlist.nickName}</span></p>
                    <p>问诊时间<span>{Historicalconsultationlist.inquiryTime}</span></p>
                    <p className="chkan"><span onClick={interviewchathistory}>查看问诊记录</span><span onClick={checkoutthereviews}>查看评价</span></p>
                </div>
            </div>
        </div>
    )
}
export default Index